package cn.sprhib.test;

import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.orm.hibernate3.HibernateTemplate;

import cn.sprhib.model.Users;

public class SaveUsers {
	
	BeanFactory factory = null;
	@Test
	public void testSave(){
		factory = new FileSystemXmlApplicationContext("WebContent/WEB-INF/sprhib-data.xml");   
		HibernateTemplate hibernateTemplate = (HibernateTemplate) factory.getBean("hibernateTemplate");
		
		Users user = new Users();
		user.setUsername("zhanglei");
		user.setPassword("qweasd");
		
		hibernateTemplate.save(user);
	}
	
	
}
